How to : implement user - defined conversions between structs 如何:在结构之间实现用户定义的转换
User - defined conversions sample > “用户定义的转换”示例
Other conversions , such as user - defined conversions , are not considered 不考虑其他转换,如用户定义的转换。
To build and run the user - defined conversions samples from the command line 从命令行生成并运行“用户定义的转换”示例
How to : implement user - defined conversions between structs c programming guide 如何:在结构之间实现用户定义的转换( c #编程指南)
To build and run the user - defined conversions samples within visual studio in 在visual studio中生成并运行“用户定义的转换”示例
Conversion operator design guidelines how to : implement user - defined conversions between structs c programming guide 如何:在结构之间实现用户定义的转换( c #编程指南)
Keyword to overload a built - in operator or to provide a user - defined conversion in a class or struct declaration 关键字用于在类或结构声明中声明运算符。运算符声明可以采用下列四种形式之一:
The as operator cannot perform other conversions , such as user - defined conversions , which should instead be performed using cast expressions 运算符无法执行其他转换,如用户定义的转换,这类转换应使用cast表达式来执行。
If a user - defined conversion is defined between two data types , the same conversion can also be used with the nullable versions of these data types 如果两种数据类型之间定义了用户定义的转换,则同一转换也可用于这些数据类型的可空版本。